<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>二维码已过期</title>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f8f9fa;
        }
        .timeout-container {
            text-align: center;
            padding: 2rem;
            border-radius: 0.5rem;
            background-color: white;
            box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        }
        .timeout-icon {
            font-size: 5rem;
            color: #dc3545;
            margin-bottom: 1rem;
        }
        .btn-retry {
            margin-top: 1.5rem;
        }
    </style>
</head>
<body>
    <div class="timeout-container">
        <div class="timeout-icon">
            <i class="fas fa-exclamation-circle"></i>
        </div>
        <h2>二维码已过期</h2>
        <p class="text-muted">当前二维码已超过有效期，请刷新页面获取新的二维码</p>
        <button class="btn btn-primary btn-retry" onclick="closeWindow()">
            <i class="fas fa-sync-alt"></i> 重新扫描
        </button>
        <script>
            function closeWindow() {
                // 判断微信环境
                if(/MicroMessenger/i.test(navigator.userAgent)) {
                    if(typeof WeixinJSBridge !== 'undefined') {
                        WeixinJSBridge.call('closeWindow');
                    } else {
                        window.close();
                    }
                } 
                // 判断移动端浏览器
                else if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                    window.close();
                } 
                // PC浏览器
                else {
                    window.close();
                }
            }
        </script>
    </div>

    <script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/bootstrap.bundle.min.js}"></script>
    <script th:src="@{/js/fontawesome/all.min.js}"></script>
</body>
</html>